//
//  WSMusicCollectionViewCell.m
//  RunningMan
//
//  Created by 王帅 on 16/5/23.
//  Copyright © 2016年 WSJ. All rights reserved.
//

#import "WSMusicCollectionViewCell.h"
#import "WSMyTool.h"

@interface WSMusicCollectionViewCell ()
@property (nonatomic, strong) UIImageView *imageViewPlayList;
@property (nonatomic, strong) UILabel *labelTitle;
@property (nonatomic, strong) UILabel *labelPlay_count;
@end
@implementation WSMusicCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

- (void)createSubView {
    
    self.imageViewPlayList = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 190 * FITWIDTH,  130 * FITHEIGHT)];
    [self.contentView addSubview:self.imageViewPlayList];
    
    self.labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(10, 140 * FITHEIGHT, 190 * FITWIDTH, 30 * FITHEIGHT)];
    self.labelTitle.font = [UIFont systemFontOfSize:17 * FITHEIGHT weight:0.1];
    self.labelTitle.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.labelTitle];
    
    UIImageView *imageViewPlay_Count = [[UIImageView alloc] initWithFrame:CGRectMake(145 * FITWIDTH, 110 * FITHEIGHT, 20 * FITWIDTH, 20 * FITHEIGHT)];
    
    imageViewPlay_Count.backgroundColor = [UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1.0];
    imageViewPlay_Count.image = [UIImage imageNamed:@"yinyue"];
    [self.contentView addSubview:imageViewPlay_Count];
    
    self.labelPlay_count = [[UILabel alloc] initWithFrame:CGRectMake(165 * FITWIDTH, 110 * FITHEIGHT, 30 * FITWIDTH, 20 * FITHEIGHT)];
    self.labelPlay_count.backgroundColor = [UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1.0];
    self.labelPlay_count.textAlignment = NSTextAlignmentCenter;
    self.labelPlay_count.font = [UIFont systemFontOfSize:12 * FITHEIGHT];
    self.labelPlay_count.textColor = [UIColor colorWithRed:60 / 255.0 green:180 / 255.0 blue:80 / 255.0 alpha:1.0];
    [self.contentView addSubview:self.labelPlay_count];
}

-(void)setModel:(WSMusicModel *)model {
    _model = model;
    [self.imageViewPlayList sd_setImageWithURL:[NSURL URLWithString:model.playlist_small_image] placeholderImage:[UIImage imageNamed:@"1.jpg"]];
    self.labelTitle.text = model.playlist_name;
    
    self.labelPlay_count.text = [NSString stringWithFormat:@"%ld", model.play_count];
}


@end
